cmake_minimum_required(VERSION 3.10)

if(TARGET "pplkernelcuda_static")
    return()
endif()

add_library(pplkernelcuda_static STATIC IMPORTED)

if(NOT TARGET "pplcommon_static")
    include(${CMAKE_CURRENT_LIST_DIR}/pplcommon-config.cmake)
endif()

# set `PPLNN_CUDA_TOOLKIT_LINK_LIBRARIES` to overwrite the default options, i.e. use static libraries instead.
if(PPLNN_CUDA_TOOLKIT_LINK_LIBRARIES)
    set(__PPLNN_CUDA_TOOLKIT_LINK_LIBRARIES__ ${PPLNN_CUDA_TOOLKIT_LINK_LIBRARIES})
else()
    set(__PPLNN_CUDA_TOOLKIT_LINK_LIBRARIES__ "@PPLNN_CUDA_TOOLKIT_LINK_LIBRARIES@")
endif()

set_target_properties(pplkernelcuda_static PROPERTIES
    INTERFACE_LINK_LIBRARIES "pplcommon_static;${__PPLNN_CUDA_TOOLKIT_LINK_LIBRARIES__}")

target_compile_definitions(pplkernelcuda_static PUBLIC @PPLNN_CUDA_BINARY_DEFINITIONS@)

unset(__PPLNN_CUDA_TOOLKIT_LINK_LIBRARIES__)

get_filename_component(__PPLNN_CUDA_LIB_PATH__ "${CMAKE_CURRENT_LIST_DIR}/../../../lib/@HPCC_STATIC_LIB_PREFIX@pplkernelcuda_static@HPCC_STATIC_LIB_SUFFIX@" ABSOLUTE)
set_target_properties(pplkernelcuda_static PROPERTIES
    IMPORTED_LOCATION "${__PPLNN_CUDA_LIB_PATH__}"
    IMPORTED_LOCATION_DEBUG "${__PPLNN_CUDA_LIB_PATH__}"
    IMPORTED_LOCATION_RELEASE "${__PPLNN_CUDA_LIB_PATH__}")
unset(__PPLNN_CUDA_LIB_PATH__)
